class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.r: E = None
        self.p: D = None
        self.txt = txt

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

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

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

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

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

h = A("h")
e = B("e")
g = C("g")
c = D("c")
i = E("i")
a = F("a")
f = D("f")
j = B("j")

h.u = i
h.r = i
h.p = f
e.z = f
e.q = h
g.v = e
g.z = h
g.r = a
g.q = j
g.o = i
c.s = e
i.x = g
i.u = g
i.p = e
a.t = e
f.s = j
j.z = c
j.q = h
assert i.p.z.s.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.r: E = None
        self.p: D = None
        self.txt = txt

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

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

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

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

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

h = A("h")
e = B("e")
g = C("g")
c = D("c")
i = E("i")
a = F("a")
f = D("f")
j = B("j")

h.u = i
h.r = i
h.p = f
e.z = f
e.q = h
g.v = e
g.z = h
g.r = a
g.q = j
g.o = i
c.s = e
i.x = g
i.u = g
i.p = e
a.t = e
f.s = j
j.z = c
j.q = h
assert i.p.z.s.z.s.txt == "e"