class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.u: D = None
        self.q: F = None
        self.o: F = None
        self.x: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: D = None
        self.u: A = None
        self.w: D = None
        self.r: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.u: B = None
        self.t: D = None
        self.q: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: D = None
        self.u: A = None
        self.w: D = None
        self.r: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.u: B = None
        self.t: D = None
        self.q: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

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