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

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

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

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

c = A("c")
j = B("j")
h = C("h")
m = D("m")
g = A("g")
i = C("i")
l = A("l")
f = C("f")
b = D("b")

c.y = l
j.x = f
j.t = m
j.o = m
j.r = c
h.p = i
h.o = j
h.r = g
m.r = l
m.p = b
g.y = c
i.p = f
i.o = j
i.r = g
l.y = g
f.p = i
f.o = j
f.r = g
b.r = l
b.p = m
assert j.r.y.y.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

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

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

c = A("c")
j = B("j")
h = C("h")
m = D("m")
g = A("g")
i = C("i")
l = A("l")
f = C("f")
b = D("b")

c.y = l
j.x = f
j.t = m
j.o = m
j.r = c
h.p = i
h.o = j
h.r = g
m.r = l
m.p = b
g.y = c
i.p = f
i.o = j
i.r = g
l.y = g
f.p = i
f.o = j
f.r = g
b.r = l
b.p = m
assert j.r.y.y.y.y.y.y.y.txt == "l"