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

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

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

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

i = A("i")
b = B("b")
h = C("h")
j = D("j")
e = B("e")
n = C("n")
f = D("f")

i.r = h
i.w = e
b.x = f
b.w = f
b.o = i
h.o = f
h.t = f
h.x = j
h.p = n
j.x = n
j.s = f
e.x = j
e.w = f
e.o = i
n.o = j
n.x = j
n.t = f
n.p = h
f.x = h
f.s = j
assert f.x.p.p.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: B = None
        self.txt = txt

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

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

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

i = A("i")
b = B("b")
h = C("h")
j = D("j")
e = B("e")
n = C("n")
f = D("f")

i.r = h
i.w = e
b.x = f
b.w = f
b.o = i
h.o = f
h.t = f
h.x = j
h.p = n
j.x = n
j.s = f
e.x = j
e.w = f
e.o = i
n.o = j
n.x = j
n.t = f
n.p = h
f.x = h
f.s = j
assert f.x.p.p.p.t.txt == "f"