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

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

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.v: D = None
        self.x: F = None
        self.u: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

j = A("j")
m = B("m")
l = C("l")
c = D("c")
f = E("f")
b = F("b")

j.r = l
j.s = c
m.s = b
m.p = l
m.o = f
l.p = f
l.v = c
l.x = b
l.u = m
c.u = j
f.y = c
f.t = c
f.s = b
b.o = c
assert l.p.s.o.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.s: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.v: D = None
        self.x: F = None
        self.u: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

j = A("j")
m = B("m")
l = C("l")
c = D("c")
f = E("f")
b = F("b")

j.r = l
j.s = c
m.s = b
m.p = l
m.o = f
l.p = f
l.v = c
l.x = b
l.u = m
c.u = j
f.y = c
f.t = c
f.s = b
b.o = c
assert l.p.s.o.u.s.txt == "c"