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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.w: C = None
        self.z: E = None
        self.x: A = None
        self.u: D = None
        self.p: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.q: C = None
        self.p: E = None
        self.txt = txt

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

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

h = A("h")
m = B("m")
l = C("l")
k = D("k")
c = E("c")
g = F("g")

h.q = c
h.z = l
m.t = h
m.x = h
m.w = l
m.z = c
m.u = k
m.p = k
l.t = h
k.s = h
k.q = l
k.p = c
c.r = l
c.u = g
g.y = l
g.p = l
g.x = c
assert g.x.r.t.q.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.w: C = None
        self.z: E = None
        self.x: A = None
        self.u: D = None
        self.p: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.q: C = None
        self.p: E = None
        self.txt = txt

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

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

h = A("h")
m = B("m")
l = C("l")
k = D("k")
c = E("c")
g = F("g")

h.q = c
h.z = l
m.t = h
m.x = h
m.w = l
m.z = c
m.u = k
m.p = k
l.t = h
k.s = h
k.q = l
k.p = c
c.r = l
c.u = g
g.y = l
g.p = l
g.x = c
assert g.x.r.t.q.u.p.txt == "l"