class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: B = None
        self.y: B = None
        self.o: C = None
        self.txt = txt

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

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

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

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

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

e = A("e")
c = B("c")
n = C("n")
f = D("f")
j = E("j")
h = F("h")

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

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

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

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

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

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

e = A("e")
c = B("c")
n = C("n")
f = D("f")
j = E("j")
h = F("h")

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