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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: E = None
        self.u: E = None
        self.q: C = None
        self.z: E = None
        self.y: C = None
        self.txt = txt

d = A("d")
j = B("j")
m = C("m")
i = D("i")
b = E("b")
c = F("c")
h = D("h")

d.p = c
d.v = m
d.s = m
d.q = b
j.r = c
j.v = c
j.p = b
j.q = b
j.x = m
m.q = i
i.v = m
b.p = m
c.r = b
c.u = b
c.z = b
c.q = m
c.y = m
h.v = m
assert j.r.q.q.v.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.v: C = None
        self.s: C = None
        self.q: E = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: E = None
        self.u: E = None
        self.q: C = None
        self.z: E = None
        self.y: C = None
        self.txt = txt

d = A("d")
j = B("j")
m = C("m")
i = D("i")
b = E("b")
c = F("c")
h = D("h")

d.p = c
d.v = m
d.s = m
d.q = b
j.r = c
j.v = c
j.p = b
j.q = b
j.x = m
m.q = i
i.v = m
b.p = m
c.r = b
c.u = b
c.z = b
c.q = m
c.y = m
h.v = m
assert j.r.q.q.v.q.v.txt == "m"