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

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: F = None
        self.x: E = None
        self.o: E = None
        self.txt = txt

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

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

m = A("m")
j = B("j")
n = C("n")
a = D("a")
g = E("g")
b = F("b")
f = D("f")

m.t = n
m.p = a
j.o = f
j.w = m
n.u = m
a.p = j
a.w = b
a.x = g
a.o = g
g.p = b
b.s = g
f.p = j
f.w = b
f.x = g
f.o = g
assert f.o.p.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: F = None
        self.x: E = None
        self.o: E = None
        self.txt = txt

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

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

m = A("m")
j = B("j")
n = C("n")
a = D("a")
g = E("g")
b = F("b")
f = D("f")

m.t = n
m.p = a
j.o = f
j.w = m
n.u = m
a.p = j
a.w = b
a.x = g
a.o = g
g.p = b
b.s = g
f.p = j
f.w = b
f.x = g
f.o = g
assert f.o.p.s.p.txt == "b"