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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.o: F = None
        self.txt = txt

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

d = A("d")
a = B("a")
m = C("m")
b = D("b")
l = E("l")
f = F("f")
g = B("g")
c = F("c")
k = D("k")

d.u = a
d.x = k
d.r = g
a.s = d
m.p = f
b.z = d
b.r = l
l.u = m
l.o = c
f.y = l
f.u = a
f.s = b
g.s = d
c.y = l
c.u = a
c.s = b
k.z = d
k.r = l
assert k.r.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: D = None
        self.r: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.o: F = None
        self.txt = txt

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

d = A("d")
a = B("a")
m = C("m")
b = D("b")
l = E("l")
f = F("f")
g = B("g")
c = F("c")
k = D("k")

d.u = a
d.x = k
d.r = g
a.s = d
m.p = f
b.z = d
b.r = l
l.u = m
l.o = c
f.y = l
f.u = a
f.s = b
g.s = d
c.y = l
c.u = a
c.s = b
k.z = d
k.r = l
assert k.r.o.y.txt == "l"