class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: D = None
        self.q: A = None
        self.t: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.v: C = None
        self.x: F = None
        self.y: F = None
        self.r: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.t: F = None
        self.x: F = None
        self.w: D = None
        self.v: C = None
        self.txt = txt

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

j.x = n
f.p = e
f.t = g
d.s = j
m.w = h
m.q = j
m.t = e
e.o = h
e.v = d
e.x = g
e.y = g
e.r = b
b.o = j
b.t = g
b.x = g
b.w = m
b.v = d
g.o = j
g.t = b
g.x = b
g.w = m
g.v = d
n.p = e
n.t = g
h.w = m
h.q = j
h.t = e
assert e.o.w.t.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: D = None
        self.q: A = None
        self.t: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.v: C = None
        self.x: F = None
        self.y: F = None
        self.r: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.t: F = None
        self.x: F = None
        self.w: D = None
        self.v: C = None
        self.txt = txt

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

j.x = n
f.p = e
f.t = g
d.s = j
m.w = h
m.q = j
m.t = e
e.o = h
e.v = d
e.x = g
e.y = g
e.r = b
b.o = j
b.t = g
b.x = g
b.w = m
b.v = d
g.o = j
g.t = b
g.x = b
g.w = m
g.v = d
n.p = e
n.t = g
h.w = m
h.q = j
h.t = e
assert e.o.w.t.o.q.txt == "j"