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

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.y: D = None
        self.u: E = None
        self.s: F = None
        self.q: D = None
        self.o: A = None
        self.txt = txt

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

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

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

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

h = A("h")
c = B("c")
e = C("e")
j = D("j")
k = E("k")
a = F("a")

h.s = j
h.t = c
c.w = j
c.y = j
c.q = j
c.u = k
c.s = a
c.o = h
e.y = h
e.v = h
e.x = k
e.o = a
j.z = k
j.x = h
k.q = a
a.q = h
assert c.s.q.s.x.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.y: D = None
        self.u: E = None
        self.s: F = None
        self.q: D = None
        self.o: A = None
        self.txt = txt

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

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

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

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

h = A("h")
c = B("c")
e = C("e")
j = D("j")
k = E("k")
a = F("a")

h.s = j
h.t = c
c.w = j
c.y = j
c.q = j
c.u = k
c.s = a
c.o = h
e.y = h
e.v = h
e.x = k
e.o = a
j.z = k
j.x = h
k.q = a
a.q = h
assert c.s.q.s.x.t.y.txt == "j"