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

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

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

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

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

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

e = A("e")
c = B("c")
m = C("m")
f = D("f")
n = E("n")
b = F("b")

e.p = c
e.y = m
e.u = b
c.s = f
c.q = m
m.s = b
m.w = c
f.y = m
n.o = c
n.x = m
b.v = n
assert c.q.s.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: C = None
        self.u: F = None
        self.txt = txt

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

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

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

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

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

e = A("e")
c = B("c")
m = C("m")
f = D("f")
n = E("n")
b = F("b")

e.p = c
e.y = m
e.u = b
c.s = f
c.q = m
m.s = b
m.w = c
f.y = m
n.o = c
n.x = m
b.v = n
assert c.q.s.v.x.txt == "m"