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

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

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

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

c = A("c")
k = B("k")
b = C("b")
m = D("m")
n = C("n")
l = A("l")
a = B("a")
e = B("e")
f = C("f")

c.o = b
c.r = l
c.w = a
c.y = m
k.w = m
k.y = m
k.p = c
b.y = c
b.q = n
b.r = l
m.s = f
n.y = c
n.r = c
n.q = f
l.o = f
l.r = c
l.w = e
l.y = m
a.w = m
a.y = m
a.p = c
e.w = m
e.y = m
e.p = l
f.y = c
f.r = c
f.q = n
assert e.y.s.q.r.y.s.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.r: A = None
        self.w: B = None
        self.y: D = None
        self.txt = txt

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

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

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

c = A("c")
k = B("k")
b = C("b")
m = D("m")
n = C("n")
l = A("l")
a = B("a")
e = B("e")
f = C("f")

c.o = b
c.r = l
c.w = a
c.y = m
k.w = m
k.y = m
k.p = c
b.y = c
b.q = n
b.r = l
m.s = f
n.y = c
n.r = c
n.q = f
l.o = f
l.r = c
l.w = e
l.y = m
a.w = m
a.y = m
a.p = c
e.w = m
e.y = m
e.p = l
f.y = c
f.r = c
f.q = n
assert e.y.s.q.r.y.s.q.q.txt == "f"