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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: C = None
        self.q: C = None
        self.x: D = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: C = None
        self.q: C = None
        self.x: D = None
        self.txt = txt

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

d.x = n
d.t = n
j.z = h
j.s = g
h.u = d
h.z = g
h.p = c
h.q = j
n.r = j
n.s = h
n.q = g
g.u = c
g.q = c
c.t = j
c.r = h
c.q = h
c.x = n
assert h.p.r.u.t.txt == "n"