class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.t: B = None
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

e = A("e")
i = B("i")
b = C("b")
j = C("j")
d = C("d")

e.w = i
e.t = i
e.q = b
i.o = d
b.t = j
b.q = e
b.r = i
j.t = d
j.q = e
j.r = i
d.t = b
d.q = e
d.r = i
assert e.w.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.t: B = None
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

e = A("e")
i = B("i")
b = C("b")
j = C("j")
d = C("d")

e.w = i
e.t = i
e.q = b
i.o = d
b.t = j
b.q = e
b.r = i
j.t = d
j.q = e
j.r = i
d.t = b
d.q = e
d.r = i
assert e.w.o.r.txt == "i"