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

class B:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: B = None
        self.txt = txt

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

e = A("e")
c = B("c")
f = C("f")
j = A("j")
l = C("l")
i = B("i")

e.r = f
e.t = c
c.q = i
c.y = i
f.y = l
j.r = l
j.t = c
l.y = f
i.q = c
i.y = c
assert l.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: B = None
        self.txt = txt

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

e = A("e")
c = B("c")
f = C("f")
j = A("j")
l = C("l")
i = B("i")

e.r = f
e.t = c
c.q = i
c.y = i
f.y = l
j.r = l
j.t = c
l.y = f
i.q = c
i.y = c
assert l.y.y.y.y.txt == "l"