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

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

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.r: F = None
        self.w: E = None
        self.y: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.v: B = None
        self.x: B = None
        self.s: A = None
        self.txt = txt

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

b = A("b")
f = B("f")
l = C("l")
m = D("m")
a = E("a")
h = F("h")
i = D("i")
k = B("k")

b.p = f
b.z = l
f.y = b
f.s = a
l.r = a
l.p = a
m.u = i
m.r = h
m.w = a
m.y = b
a.o = b
a.s = b
a.v = f
a.x = f
h.x = l
i.u = m
i.r = h
i.w = a
i.y = b
k.y = b
k.s = a
assert l.r.o.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.r: F = None
        self.w: E = None
        self.y: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.v: B = None
        self.x: B = None
        self.s: A = None
        self.txt = txt

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

b = A("b")
f = B("f")
l = C("l")
m = D("m")
a = E("a")
h = F("h")
i = D("i")
k = B("k")

b.p = f
b.z = l
f.y = b
f.s = a
l.r = a
l.p = a
m.u = i
m.r = h
m.w = a
m.y = b
a.o = b
a.s = b
a.v = f
a.x = f
h.x = l
i.u = m
i.r = h
i.w = a
i.y = b
k.y = b
k.s = a
assert l.r.o.p.s.txt == "a"