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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.q: C = 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: E = None
        self.q: E = None
        self.o: C = None
        self.txt = txt

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

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

c = A("c")
d = B("d")
b = C("b")
j = D("j")
a = E("a")
i = F("i")

c.z = j
d.y = a
d.q = b
b.y = a
j.v = a
j.q = a
j.o = b
a.z = b
a.y = j
a.r = j
a.o = c
i.y = b
assert c.z.o.y.r.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.q: C = 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: E = None
        self.q: E = None
        self.o: C = None
        self.txt = txt

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

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

c = A("c")
d = B("d")
b = C("b")
j = D("j")
a = E("a")
i = F("i")

c.z = j
d.y = a
d.q = b
b.y = a
j.v = a
j.q = a
j.o = b
a.z = b
a.y = j
a.r = j
a.o = c
i.y = b
assert c.z.o.y.r.q.o.txt == "c"