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

class B:
    def __init__(self, txt: str):
        self.x: E = None
        self.s: A = None
        self.r: F = None
        self.y: A = None
        self.o: F = None
        self.p: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.o: A = None
        self.u: E = None
        self.v: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.p: D = None
        self.s: F = None
        self.txt = txt

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

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

k.r = m
k.y = f
k.w = d
l.x = e
l.s = k
l.y = k
l.r = g
l.o = g
l.p = g
d.y = b
d.o = k
d.u = e
d.v = f
f.y = b
e.v = k
e.p = f
e.s = g
g.p = f
g.s = d
m.p = f
m.s = d
b.x = e
b.s = k
b.y = k
b.r = m
b.o = m
b.p = g
assert l.x.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.y: D = None
        self.w: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: E = None
        self.s: A = None
        self.r: F = None
        self.y: A = None
        self.o: F = None
        self.p: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.o: A = None
        self.u: E = None
        self.v: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.p: D = None
        self.s: F = None
        self.txt = txt

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

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

k.r = m
k.y = f
k.w = d
l.x = e
l.s = k
l.y = k
l.r = g
l.o = g
l.p = g
d.y = b
d.o = k
d.u = e
d.v = f
f.y = b
e.v = k
e.p = f
e.s = g
g.p = f
g.s = d
m.p = f
m.s = d
b.x = e
b.s = k
b.y = k
b.r = m
b.o = m
b.p = g
assert l.x.p.y.txt == "b"