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

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.r: E = None
        self.x: C = None
        self.o: E = None
        self.w: F = None
        self.txt = txt

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

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

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

c.z = b
c.x = j
j.x = k
j.o = c
h.y = b
a.v = h
a.x = h
a.r = b
a.o = b
a.w = k
b.u = j
b.y = c
k.p = j
assert h.y.y.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.x: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.r: E = None
        self.x: C = None
        self.o: E = None
        self.w: F = None
        self.txt = txt

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

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

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

c.z = b
c.x = j
j.x = k
j.o = c
h.y = b
a.v = h
a.x = h
a.r = b
a.o = b
a.w = k
b.u = j
b.y = c
k.p = j
assert h.y.y.z.y.txt == "c"