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

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

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

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

i = A("i")
c = B("c")
e = C("e")
d = D("d")
f = D("f")

i.w = d
i.o = d
i.t = f
c.r = f
e.t = i
e.u = c
e.y = f
d.z = e
d.r = f
d.x = i
f.z = e
f.r = d
f.x = i
assert c.r.r.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.t: D = None
        self.o: D = None
        self.txt = txt

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

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

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

i = A("i")
c = B("c")
e = C("e")
d = D("d")
f = D("f")

i.w = d
i.o = d
i.t = f
c.r = f
e.t = i
e.u = c
e.y = f
d.z = e
d.r = f
d.x = i
f.z = e
f.r = d
f.x = i
assert c.r.r.x.t.txt == "f"