class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.z: C = None
        self.q: E = None
        self.o: D = None
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.u: C = None
        self.s: E = None
        self.x: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.p: B = None
        self.txt = txt

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

n = A("n")
k = B("k")
d = C("d")
e = D("e")
g = E("g")
c = F("c")
a = D("a")

n.u = g
n.q = g
n.z = d
n.t = d
n.o = e
k.z = d
k.u = d
k.s = g
k.x = g
d.w = k
d.y = c
e.s = c
e.o = c
e.x = g
g.r = k
g.p = k
c.x = g
c.q = g
c.p = n
a.s = c
a.o = c
a.x = g
assert g.r.z.y.q.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.z: C = None
        self.q: E = None
        self.o: D = None
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.u: C = None
        self.s: E = None
        self.x: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.p: B = None
        self.txt = txt

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

n = A("n")
k = B("k")
d = C("d")
e = D("e")
g = E("g")
c = F("c")
a = D("a")

n.u = g
n.q = g
n.z = d
n.t = d
n.o = e
k.z = d
k.u = d
k.s = g
k.x = g
d.w = k
d.y = c
e.s = c
e.o = c
e.x = g
g.r = k
g.p = k
c.x = g
c.q = g
c.p = n
a.s = c
a.o = c
a.x = g
assert g.r.z.y.q.p.x.txt == "g"