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

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: C = None
        self.w: D = None
        self.y: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: A = None
        self.s: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: D = None
        self.q: D = None
        self.y: D = None
        self.txt = txt

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

e.o = i
e.y = i
e.p = b
e.q = d
i.s = c
i.v = c
i.w = f
i.y = l
j.v = c
j.s = c
j.w = e
f.u = d
f.s = d
f.q = d
f.y = d
l.s = j
l.v = j
l.w = d
l.y = i
c.v = j
c.s = j
c.w = b
d.u = f
d.s = f
d.q = f
d.y = f
b.o = i
b.p = e
b.y = l
b.q = d
assert j.w.p.q.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.p: A = None
        self.y: B = None
        self.q: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: C = None
        self.w: D = None
        self.y: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: A = None
        self.s: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: D = None
        self.q: D = None
        self.y: D = None
        self.txt = txt

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

e.o = i
e.y = i
e.p = b
e.q = d
i.s = c
i.v = c
i.w = f
i.y = l
j.v = c
j.s = c
j.w = e
f.u = d
f.s = d
f.q = d
f.y = d
l.s = j
l.v = j
l.w = d
l.y = i
c.v = j
c.s = j
c.w = b
d.u = f
d.s = f
d.q = f
d.y = f
b.o = i
b.p = e
b.y = l
b.q = d
assert j.w.p.q.q.u.txt == "d"