class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.t: E = None
        self.r: A = None
        self.u: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.p: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: D = None
        self.w: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.x: E = None
        self.u: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: F = None
        self.v: C = None
        self.r: F = None
        self.txt = txt

k = A("k")
f = B("f")
j = C("j")
g = D("g")
m = E("m")
i = F("i")
n = D("n")
l = E("l")
d = A("d")
e = F("e")

k.p = i
k.t = l
k.r = d
k.u = d
f.t = g
f.p = e
j.z = g
j.y = g
j.w = g
g.y = f
g.x = l
g.u = k
m.x = i
i.q = e
i.r = e
i.v = j
n.y = f
n.x = m
n.u = k
l.x = e
d.p = i
d.t = l
d.r = k
d.u = k
e.q = i
e.r = i
e.v = j
assert j.w.x.x.q.q.v.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.t: E = None
        self.r: A = None
        self.u: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.p: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: D = None
        self.w: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.x: E = None
        self.u: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: F = None
        self.v: C = None
        self.r: F = None
        self.txt = txt

k = A("k")
f = B("f")
j = C("j")
g = D("g")
m = E("m")
i = F("i")
n = D("n")
l = E("l")
d = A("d")
e = F("e")

k.p = i
k.t = l
k.r = d
k.u = d
f.t = g
f.p = e
j.z = g
j.y = g
j.w = g
g.y = f
g.x = l
g.u = k
m.x = i
i.q = e
i.r = e
i.v = j
n.y = f
n.x = m
n.u = k
l.x = e
d.p = i
d.t = l
d.r = k
d.u = k
e.q = i
e.r = i
e.v = j
assert j.w.x.x.q.q.v.w.txt == "g"