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

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: F = None
        self.z: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.y: F = None
        self.t: D = None
        self.s: F = None
        self.p: B = None
        self.z: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

k = A("k")
n = B("n")
h = C("h")
g = D("g")
b = E("b")
c = F("c")
d = D("d")

k.u = g
k.o = n
n.t = b
n.o = c
n.r = d
h.x = n
h.v = c
h.z = g
g.r = k
g.z = k
g.y = c
g.s = c
g.t = d
g.p = n
b.y = d
b.o = h
c.q = d
d.r = k
d.z = k
d.y = c
d.s = c
d.t = g
d.p = n
assert k.u.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.o: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: F = None
        self.z: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.y: F = None
        self.t: D = None
        self.s: F = None
        self.p: B = None
        self.z: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

k = A("k")
n = B("n")
h = C("h")
g = D("g")
b = E("b")
c = F("c")
d = D("d")

k.u = g
k.o = n
n.t = b
n.o = c
n.r = d
h.x = n
h.v = c
h.z = g
g.r = k
g.z = k
g.y = c
g.s = c
g.t = d
g.p = n
b.y = d
b.o = h
c.q = d
d.r = k
d.z = k
d.y = c
d.s = c
d.t = g
d.p = n
assert k.u.z.u.txt == "g"